package p270jp.pxv.android.advertisement.presentation.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.google.android.material.imageview.ShapeableImageView;
import java.util.Objects;
import p062c4.ViewBindings;
import p064c6.Preconditions;
import p072ce.ViewSelfServeRelatedWorksBinding;
import p130ee.SelfServeZone;
import p155fe.SelfServeService;
import p189gn.AbstractC3446l;
import p216hn.Lambda;
import p270jp.pxv.android.R;
import p270jp.pxv.android.commonObjects.model.SelfServeAdvertisement;
import p270jp.pxv.android.legacy.model.GoogleNg;
import p312le.C4643a0;
import p312le.C4644b0;
import p312le.C4669x;
import p312le.C4671z;
import p325m0.MutabilityOwnership;
import p350mp.Timber;
import p376no.Koin;
import p404oo.AbstractC5475a;
import p467rd.subscribers;
import p491sd.C6034a;
import p603wm.AbstractC6949c;
import p603wm.Unit;
import p645yc.AndroidSchedulers;
import p671zc.CompositeDisposable;
import p671zc.Disposable;
import p675zg.SelfServeRepository;
import p677zi.PixivImageLoader;

/* compiled from: SelfServeRelatedWorksView.kt */
/* renamed from: jp.pxv.android.advertisement.presentation.view.SelfServeRelatedWorksView */
/* loaded from: classes2.dex */
public final class SelfServeRelatedWorksView extends ConstraintLayout implements AbstractC5475a {

    /* renamed from: s */
    public final AbstractC6949c f18866s = Preconditions.m9802P(1, new C4671z(this, null, null));

    /* renamed from: t */
    public final AbstractC6949c f18867t = Preconditions.m9802P(1, new C4643a0(this, null, null));

    /* renamed from: u */
    public final AbstractC6949c f18868u = Preconditions.m9802P(1, new C4644b0(this, null, null));

    /* renamed from: v */
    public final ViewSelfServeRelatedWorksBinding f18869v;

    /* renamed from: w */
    public boolean f18870w;

    /* compiled from: SelfServeRelatedWorksView.kt */
    /* renamed from: jp.pxv.android.advertisement.presentation.view.SelfServeRelatedWorksView$b */
    /* loaded from: classes2.dex */
    public static final class C4185b extends Lambda implements AbstractC3446l<Throwable, Unit> {
        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4185b() {
            super(1);
            SelfServeRelatedWorksView.this = r1;
        }

        @Override // p189gn.AbstractC3446l
        public Unit invoke(Throwable th) {
            MutabilityOwnership.m3745m(th, "it");
            SelfServeRelatedWorksView.this.setVisibility(8);
            return Unit.f29503a;
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public SelfServeRelatedWorksView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet, 0, 0);
        MutabilityOwnership.m3745m(context, "context");
        LayoutInflater.from(getContext()).inflate(R.layout.view_self_serve_related_works, this);
        int i = R.id.ad_image;
        ShapeableImageView shapeableImageView = (ShapeableImageView) ViewBindings.m9835b(this, R.id.ad_image);
        if (shapeableImageView != null) {
            i = R.id.ad_text;
            TextView textView = (TextView) ViewBindings.m9835b(this, R.id.ad_text);
            if (textView != null) {
                i = R.id.ad_title;
                TextView textView2 = (TextView) ViewBindings.m9835b(this, R.id.ad_title);
                if (textView2 != null) {
                    i = R.id.pr_label;
                    TextView textView3 = (TextView) ViewBindings.m9835b(this, R.id.pr_label);
                    if (textView3 != null) {
                        this.f18869v = new ViewSelfServeRelatedWorksBinding(this, shapeableImageView, textView, textView2, textView3);
                        return;
                    }
                }
            }
        }
        throw new NullPointerException("Missing required view with ID: ".concat(getResources().getResourceName(i)));
    }

    public final CompositeDisposable getCompositeDisposable() {
        return (CompositeDisposable) this.f18866s.getValue();
    }

    private final PixivImageLoader getPixivImageLoader() {
        return (PixivImageLoader) this.f18868u.getValue();
    }

    public final SelfServeService getSelfServeService() {
        return (SelfServeService) this.f18867t.getValue();
    }

    /* renamed from: s */
    public static final void m4644s(SelfServeRelatedWorksView selfServeRelatedWorksView, SelfServeAdvertisement selfServeAdvertisement) {
        PixivImageLoader pixivImageLoader = selfServeRelatedWorksView.getPixivImageLoader();
        Context context = selfServeRelatedWorksView.getContext();
        MutabilityOwnership.m3746l(context, "context");
        ShapeableImageView shapeableImageView = selfServeRelatedWorksView.f18869v.f5435b;
        MutabilityOwnership.m3746l(shapeableImageView, "binding.adImage");
        pixivImageLoader.m63c(context, shapeableImageView, selfServeAdvertisement.getAdImageUrl(), new C4669x(selfServeRelatedWorksView, selfServeAdvertisement));
    }

    /* renamed from: v */
    public static final void m4641v(SelfServeRelatedWorksView selfServeRelatedWorksView, String str) {
        SelfServeService selfServeService = selfServeRelatedWorksView.getSelfServeService();
        Objects.requireNonNull(selfServeService);
        MutabilityOwnership.m3745m(str, "impUrl");
        SelfServeRepository cVar = selfServeService.f14515a;
        Objects.requireNonNull(cVar);
        Disposable f = subscribers.m2590f(cVar.f31478a.m3561a(str).m1008i(C6034a.f26178c).m1011f(AndroidSchedulers.m334a()), new AbstractC3446l<Throwable, Unit>(Timber.f23100a) { // from class: le.y
            @Override // p189gn.AbstractC3446l
            public Unit invoke(Throwable th) {
                ((Timber.C4879b) this.receiver).mo3514p(th);
                return Unit.f29503a;
            }
        }, null, 2);
        CompositeDisposable compositeDisposable = selfServeRelatedWorksView.getCompositeDisposable();
        MutabilityOwnership.m3744n(compositeDisposable, "compositeDisposable");
        compositeDisposable.mo82c(f);
    }

    @Override // p404oo.AbstractC5475a
    public Koin getKoin() {
        return AbstractC5475a.C5476a.m3211a(this);
    }

    /* renamed from: w */
    public final void m4640w() {
        getCompositeDisposable().m80f();
    }

    /* renamed from: x */
    public final void m4639x(GoogleNg googleNg) {
        MutabilityOwnership.m3745m(googleNg, "googleNg");
        if (!this.f18870w) {
            SelfServeService selfServeService = getSelfServeService();
            SelfServeZone aVar = SelfServeZone.RelatedWorks;
            String string = getContext().getString(R.string.yufulight_language_setting);
            MutabilityOwnership.m3746l(string, "context.getString(jp.pxv…fulight_language_setting)");
            Disposable e = subscribers.m2591e(selfServeService.m6311b(googleNg, aVar, string).m961o(C6034a.f26178c).m966j(AndroidSchedulers.m334a()), new C4185b(), new AbstractC3446l<SelfServeAdvertisement, Unit>(this) { // from class: jp.pxv.android.advertisement.presentation.view.SelfServeRelatedWorksView.a
                @Override // p189gn.AbstractC3446l
                public Unit invoke(SelfServeAdvertisement selfServeAdvertisement) {
                    SelfServeAdvertisement selfServeAdvertisement2 = selfServeAdvertisement;
                    MutabilityOwnership.m3745m(selfServeAdvertisement2, "p0");
                    SelfServeRelatedWorksView.m4644s((SelfServeRelatedWorksView) this.receiver, selfServeAdvertisement2);
                    return Unit.f29503a;
                }
            });
            CompositeDisposable compositeDisposable = getCompositeDisposable();
            MutabilityOwnership.m3744n(compositeDisposable, "compositeDisposable");
            compositeDisposable.mo82c(e);
        }
    }
}
